from drg_group.yinchuan_2023.Base import message,intersect,SS_VALID
from drg_group.yinchuan_2023.DRG import MDCO_DRG

def group(record):
  adrg_zd=["O00.100","O00.101","O00.102","O00.103","O00.104","O00.105","O00.106","O00.107","O00.109","O00.110","O00.111","O00.112","O00.113","O00.114","O00.115","O00.116","O00.200","O00.201","O00.803","O00.804","O00.807","O00.808","O00.809","O00.900","O00.901","O08.100x003","O08.105","O08.302"]
  adrg_zd1=[]
  adrg_ss=["54.1100","54.1101","54.5100x009","65.0101","65.0105","65.0905","65.2400","65.2501","65.2502","65.2505","65.2900x011","65.2901","65.7100x001","65.7901","65.7905","66.0100x006","66.0102","66.0103","66.0200","66.0201","66.0202","66.0203","66.2200x001","66.2901","66.2903","66.3900x001","66.3900x004","66.4x00","66.4x02","66.5100","66.5102","66.6102","66.6104","66.6200","66.6200x003","66.6200x004","66.6201","66.6301","66.6901","66.6902","66.7100","66.7100x002","66.7300","66.7301","66.7901","66.7905","66.8x02","66.9201","66.9202","66.9203","66.9204","66.9500x001","66.9500x004","68.2900x035","68.2900x037","74.3x00x012","74.3x00x017","74.3x00x018","74.3x02","74.3x03","74.3x04","74.3x06","74.3x07","74.3x08","74.3x09"]
  adrg_ss1=[]
  adrg_ss2=[]
  dept_list=[]
  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss and record.ssList and intersect(record.ssList,adrg_ss):
    message('符合OE1入组条件，匹配规则：主诊断匹配、主手术匹配、某一手术匹配')
    
    if MDCO_DRG.OE19_group(record):
      return 'OE19'

    return 'OE1'
  else:
    return ''

